import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()) {
            int n = in.nextInt();
            int[] array = new int[3*n];
            for (int i = 0; i < 3*n; i++) {
                array[i] = in.nextInt();
            }
            Arrays.sort(array);
            long sum = 0;
            for (int i = 3*n-2; i >= n; i-=2) {
                sum += array[i];
            }
            System.out.println(sum);
        }
    }

    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextLine()) {
            StringBuilder str1 = new StringBuilder(in.nextLine());
            StringBuilder str2 = new StringBuilder(in.nextLine());
            StringBuilder str3 = new StringBuilder();
            for (int i = 0; i < str1.length(); i++) {
                boolean a = false;
                for (int j = 0; j < str2.length(); j++) {
                    if(str1.charAt(i) == str2.charAt(j)) {
                        a = true;
                        break;
                    }
                }
                if(!a) {
                    str3.append(str1.charAt(i));
                }
            }
            System.out.println(str3.toString());
        }
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextLine()) {
            String str1 = in.nextLine();
            String str2 = in.nextLine();
            HashMap<Character,Integer> map = new HashMap<>();
            for (int i = 0; i < str2.length(); i++) {
                if(map.get(str2.charAt(i)) == null) {
                    map.put(str2.charAt(i),1);
                }else {
                    map.put(str2.charAt(i),map.get(str2.charAt(i)) + 1);
                }
            }
            String ret = "";
            for (int i = 0; i < str1.length(); i++) {
                if(map.get(str1.charAt(i)) == null) {
                    ret += str1.charAt(i);
                }
            }
            System.out.println(ret);
        }
    }
}
